﻿using System;
using System.Collections.Generic;

using System.Text;
using System.IO;

namespace Estimate.Common.DataFileFinder
{
    /// <summary>
    /// 市代县文件发现类
    /// </summary>
    public class SdxCityForeFinder : IDataFileFinder
    {
        public string[] GetFileFromDirectory(DateTime dt, string dirPath)
        {
            string date = dt.ToString("yyyyMMdd");
            string date0 = dt.AddDays(-1).ToString("yyyyMMdd");
            List<string> files = new List<string>();

            if (Directory.Exists(dirPath))
            {
                //早晨06点预报
                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date0 + "20????" + "_P_RFFC-SPCC-" + date + "0000-07212.TXT"));

                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date0 + "21????" + "_P_RFFC-SPCC-" + date + "0000-16812.TXT"));

                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date0 + "22????" + "_P_RFFC-SPCC-" + date + "0000-16812.TXT"));

                //早晨10点预报
                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date + "01????" + "_P_RFFC-SPCC-" + date + "0000-16812.TXT"));

                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date + "02????" + "_P_RFFC-SPCC-" + date + "0000-16812.TXT"));

                //下午16点预报
                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date + "07????" + "_P_RFFC-SPCC-" + date + "1200-16812.TXT"));

                files.AddRange(Directory.GetFiles(dirPath, "Z_SEVP_I_58???_" + date + "08????" + "_P_RFFC-SPCC-" + date + "1200-16812.TXT"));

            }
            else
            {
                Console.WriteLine("Can't find directory named {0}", dirPath);
            }
            
            return files.ToArray();
        }


        public string[] GetFileNames(DateTime dt)
        {
            throw new NotImplementedException();
        }


        public Dictionary<string, string[]> GetFileListFromDirectory(DateTime dt, string dirPath)
        {
            throw new NotImplementedException();
        }

        public Dictionary<string, string[]> GetFileListFromDirectory(DateTime dt, string dirPath, string fileFilter)
        {
            return null;
        }

        public string[] GetFileFromDirectory(DateTime dt, string dirPath, string fileFilter)
        {
            return null;
        }

    }
}
